package com.cy.pj.common.pojo;

import java.io.Serializable;
import java.util.List;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class PageObject<T> implements Serializable{


	private static final long serialVersionUID = 7678435067477182108L;
	
	//当前页码值(客户端传过来的)
	private Integer pageCurrent=1;
	//页面大小(每页最多显示多少条记录)
	private Integer pageSize=3;
	//总记录数(数据库里查询出来的总记录数)
	private Integer rowCount=0;
	//总页数(基于总记录数和页面大小计算出来的)
	private Integer pageCount=0;
	//当前页查询出来的所有记录
	private List<T> records;
	
	public PageObject(Integer pageCurrent, Integer pageSize, Integer rowCount, List<T> records) {
		super();
		this.pageCurrent = pageCurrent;
		this.pageSize = pageSize;
		this.rowCount = rowCount;
		this.records = records;
		//总页数在有参构造方法中计算，所以不需要在构造方法参数中加此参数，也不需要调用者传此参数
		this.pageCount = (rowCount-1)/pageSize+1;
	}
	
	
}
